<?php
class Contact extends CI_Controller{
    function  __construct(){
        parent::__construct();        
    }
    function index(){
        $this->load->library('form_validation');
        if(!empty($_POST)){
            $this->form_validation->set_rules('ten', 'Name', 'trim|required|min_length[5]|max_length[100]|xss_clean');
            $this->form_validation->set_rules('dienthoai', 'Phone', 'trim|numeric|min_length[9]|max_length[15]|required|xss_clean');
            $this->form_validation->set_rules('diachi', 'Address', 'trim|required|xss_clean');
            $this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email|xss_clean');
            $this->form_validation->set_rules('thongtin', 'Content', 'trim|xss_clean');
            if ($this->form_validation->run() == FALSE){  
                   
        		}
        		else{            			
                    $data = $this->security->xss_clean($_POST);
                    $this->db->insert('contact', $data); 
                    $this->load->view('default/index',array('content'=>'<div id=yeucau>Success !<br><font color=blue></font></div>'));  
                    return;     
        		}
        
        } 
    //array('content'=>)
    $dt->title = "Contact";
    $dt ->content  = $this->load->view('contact/form_contact','',true);      
    $dt = $this->template->render($dt);  
    $this->load->view('default/viewfull',$dt);
                 
            
	}
       
    
}